/**
 * Created by renzhiqiang on 17/8/12.
 */
import React ,{Component, PropTypes, PureComponent} from "react";
import { createStore,applyMiddleware,combineReducers} from 'redux'
import Counter from './components/couter'
// import todos from './reduer/idx'
// import counter from './reduer/index'
import DevTools from './devtools/index';
import { composeWithDevTools } from 'redux-devtools-extension';
function todos(statea =2,action) {
    switch (action.type) {
        case 'aINCREMENT':
            return statea + 1;
        case 'aDECREMENT':
            return statea - 1;
        default:
            return statea
    }
}
function counter(state =0,action) {
    switch (action.type) {
        case 'INCREMENT':
            return state + 1;
        case 'DECREMENT':
            return state - 1;
        default:
            return state
    }
}
var combin = combineReducers({todos,counter});


const store = createStore(counter);



module.exports  = React.createClass({
    render: function() {
        return <div><Counter value={store.getState()} onIncrement={() => store.dispatch({ type: 'INCREMENT' })} onDecrement={() => store.dispatch({ type: 'DECREMENT' })}></Counter></div>;
    }
});
store.subscribe(function (data) {
    console.info(data);
});
